package com.witmore.skyline.web.controller;

import com.witmore.skyline.web.controller.vo.param.CameraPicQueryParam;
import com.witmore.skyline.web.controller.vo.result.CameraPicResult;
import com.witmore.skyline.web.controller.vo.result.ResponsePageResult;
import com.witmore.skyline.web.controller.vo.result.ResponseResult;
import com.witmore.skyline.web.service.PictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

/**
 * 图片管理  2.0
 * Author: 豆子高
 * Date: 2025/4/17 16:07
 */
@RestController
@RequestMapping("api/picture/")
public class PictureController {

    @Autowired
    private PictureService pictureService;

    /**
     * 图片列表 2.0
     */
    @GetMapping(value = "list", name = "图片列表")
    public ResponsePageResult<CameraPicResult> list(@Valid CameraPicQueryParam param) {
        return pictureService.list(param);
    }

    /**
     * 删除图片 2.0
     */
    @PostMapping(value = "delete", name = "删除图片")
    public ResponseResult<Void> delete(@RequestParam("id") Integer id) {
        return pictureService.delete(id);
    }


    /**
     * AI分析
     */
    @PostMapping(value = "aiCheck", name = "AI检测图片")
    public ResponseResult<Void> aiCheck(@RequestParam("cameraPicId") Integer cameraPicId) throws Exception {
        return pictureService.aiCheck(cameraPicId);
    }

    /**
     * AI矫正
     */
    @PostMapping(value = "aiCheckCorrect", name = "AI矫正")
    public ResponseResult<Void> aiCheckCorrect(@RequestParam("cameraPicId") Integer cameraPicId) throws Exception {
        return pictureService.aiCheckCorrect(cameraPicId);
    }
}
